home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / File / Make Visible < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.8 KB  |  101 lines  |  [TEXT/ToyS]

  1. -- Preferences
  2. property kasPrefName : "Make Visible 1.0"
  3.  
  4. -- Globals
  5. global gasInfoWind -- Info window
  6. global gasInfoPos -- Position of info window
  7. global gasDid -- Number gone!
  8. global gasChecked -- Number checked!
  9.  
  10.  
  11. on open fsObjs
  12.     -- Load prefs, show window
  13.     pfLoad()
  14.     
  15.     set gasDid to 0
  16.     set gasChecked to 0
  17.     
  18.     set gasInfoWind to display info titled kasPrefName ¬
  19.         located at gasInfoPos ¬
  20.         message "Scanning…"
  21.     
  22.     -- Do files
  23.     repeat with fsObj in fsObjs
  24.         set myInfo to (extended info for fsObj)
  25.         
  26.         if (invisible status of myInfo) then
  27.             DoOne(fsObj)
  28.         end if
  29.     end repeat
  30.     
  31.     display info gasInfoWind message "DONE!"
  32.     
  33.     pause for 5 with seconds timing -- Let screen wait...
  34.     
  35.     set gasInfoPos to screen location of ¬
  36.         (display info gasInfoWind with disposal)
  37.     
  38.     pfSave() -- Save window location
  39. end open
  40.  
  41.  
  42. on DoOne(fsObj)
  43.     set aFileInfo to (alias info from fsObj)
  44.     
  45.     display info gasInfoWind ¬
  46.         message "File: " & (original name of aFileInfo) ¬
  47.         at line 2
  48.     
  49.     set gasChecked to gasChecked + 1
  50.     
  51.     try
  52.         set myInfo to (extended info for fsObj)
  53.     on error
  54.         beep
  55.         return
  56.     end try
  57.     
  58.     set invisible status of myInfo to false
  59.     
  60.     try
  61.         set the catalog info of fsObj to myInfo
  62.         set gasDid to gasDid + 1
  63.         display info gasInfoWind ¬
  64.             message ("Did: " & gasDid) ¬
  65.             at line 6 ¬
  66.             using color 15 * 32
  67.     on error
  68.         beep
  69.     end try
  70.     
  71.     set myInfo to (extended info for fsObj)
  72.     
  73.     if (invisible status of myInfo) then
  74.         display info gasInfoWind ¬
  75.             message ("Couldn't change status") ¬
  76.             at line 5 ¬
  77.             using color 15 * 32 * 32
  78.         beep
  79.     end if
  80.     
  81.     display info gasInfoWind ¬
  82.         message ("Checked: " & gasChecked) ¬
  83.         at line 7 ¬
  84.         using color 15
  85. end DoOne
  86.  
  87.  
  88. on pfLoad()
  89.     try
  90.         set ourPrefs to (load preference named kasPrefName)
  91.         set gasInfoPos to item 1 of ourPrefs
  92.     on error
  93.         set gasInfoPos to {0, 0}
  94.     end try
  95. end pfLoad
  96.  
  97.  
  98. on pfSave()
  99.     save preference {gasInfoPos} named kasPrefName
  100. end pfSave
  101.